/**
 * 文件上传路由
 * @module routes/uploadRoutes
 */

const express = require('express');
const router = express.Router();
const uploadController = require('../controllers/uploadController');
const { uploadImage } = require('../middleware/upload');
const { authenticateToken, isAdmin } = require('../middleware/auth');

// 上传图片 (需要管理员权限)
router.post('/image', authenticateToken, isAdmin, uploadImage.single('image'), uploadController.uploadImage);

// 删除文件 (需要管理员权限)
router.delete('/:filename', authenticateToken, isAdmin, uploadController.deleteFile);

module.exports = router; 